﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebLibs;
using System.Data;

namespace MDF.DataHelper.DataObject.NewsDO
{
    public class EmailReciveDAO : BaseDataObject
    {
         #region Constructor

        public EmailReciveDAO()
        {
        }

        public EmailReciveDAO(IData _objData)
        {
            this.m_objData = _objData;
        }
        #endregion

        #region Methods

        public void Insert(string email)
        {
            try
            {
                this.Connect();

                this.m_objData.CreateNewStoredProcedure("[EmailRecive_Insert]");
                this.m_objData.AddParameter("@Email", email);
                this.m_objData.ExecNonQuery();

            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                this.DeConnect();
            }
        }

        public DataTable GetAll(int _iPage,int _iPageSize)
        {
            try
            {
                this.Connect();

                this.m_objData.CreateNewStoredProcedure("[EmailRecive_GetAll]");
                this.m_objData.AddParameter("@Page", _iPage);
                this.m_objData.AddParameter("@PageSize", _iPageSize);
                return this.m_objData.ExecStoreToDataTable();

            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                this.DeConnect();
            }
        }

        public void Delete(string _strEmail)
        {
            try
            {
                this.Connect();

                this.m_objData.CreateNewStoredProcedure("[EmailRecive_Delete]");
                this.m_objData.AddParameter("@Email", _strEmail);
                this.m_objData.ExecNonQuery();

            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                this.DeConnect();
            }
        }

        #endregion
    }
}
